

*** This do file creates Figure 3 for the minimum wage precommitment paper

clear all
capture log close
set more off

* Set path* If needed change global path to point to directory where files are stored on your computer
*global path "I:/DataSets5/Duncan/Dropbox/Recent Minimum Wage Changes/2020.12 NBER Update/JOLE Precommittment Replication"
global dtadir "$path/Data"
global tabdir "$path/Tables"
global figdir "$path/Figures"
global estdir "$path/Estimates"
global logdir "$path/Logfiles"

* Start log file
log using "$logdir/timepaths_ACS_CEPCategories2019.log", replace

*** Assemble relevant years of the ACS
use "${path}/Data/ACS-2019.dta", clear

drop if year < 2011

*** Drop seniors
drop if age >= 65 | age < 16
drop if empstat == 0

*** Construct economic outcomes of interest 

gen employed = 0
replace employed = 1 if  empstat == 1

**** Construct education variables

gen dropout = 0 
replace dropout = 1 if educ < 6
gen highschool = 0 
replace highschool = 1 if educ == 6
gen somecollege = 0
replace somecollege = 1 if educ >= 7 & educ < 10
gen collegeplus = 0
replace collegeplus = 1 if educ >= 10

**** Construct full vs part-time variable

gen parttime = 0
replace parttime  = 1 if uhrswork >= 40


***
* Assign the policy categories
***

merge m:1 statefip using "${path}\Data\min_wage_variables_for_ACS_and_CPS_analysis.dta"
drop _merge


gen indexer = 0
replace indexer = 1 if originaltype == "Indexer"
gen StatIncreaserLarge = 0
replace StatIncreaserLarge = 1 if indexer == 0 & (jan2015min - jan2013min) >= 1 & (jan2016min - jan2013min) != .
gen statutoryincreasein2014or2015 = 0
replace statutoryincreasein2014or2015 = 1 if (jan2016min - jan2013min) > 0 & indexer == 0
gen StatIncreaserSmall = 0
replace StatIncreaserSmall = 1 if indexer == 0 & statutoryincreasein2014or2015 == 1 & StatIncreaserLarge == 0

gen firstchangebyjan14 = 0
replace firstchangebyjan14 = 1 if changesby2014 == 1 & indexer == 0

gen firstchangejan14to15 = 0
replace firstchangejan14to15 = 1 if changesby2015 == 1 & changesby2014 == 0 & indexer == 0

gen firstchangejan15to16 = 0
replace firstchangejan15to16 = 1 if changesby2016 == 1 & changesby2015 == 0 & changesby2014 == 0 & indexer == 0


*** Create employment rate
gen group = 0
replace group = 1 if (age <= 30 & age > 21 & highschool == 1) | (age > 30 & age <= 45 & dropout == 1) | (age > 45 & age < 65 & dropout == 1)
rename perwt cmpwgt

*** Merge in HPI data
merge m:1 statefip year using "${path}\Data\HPI_acs_2019.dta"
drop if _merge == 2
drop _merge

*** Merge in personal income data
merge m:1 statefip year using "${path}\Data\PersonalIncome_acs_2019.dta"
replace PersonalIncome = PersonalIncome/1000
drop if _merge == 2
drop _merge

* Drop uneeded variables and compress data to speed estimation
keep employed StatIncreaserLarge StatIncreaserSmall indexer year cmpwgt ///
age educ dropout statefip HPI PersonalIncome group jan*min


compress

**
* CHECK STATE POLICY CATEGORIES 
**

tab statefip if StatIncreaserLarge == 1
tab statefip if StatIncreaserSmall == 1
tab statefip if indexer == 1

gen type = .
replace type = 1 if indexer == 0 & StatIncreaserSmall == 0 & StatIncreaserLarge == 0
replace type = 2 if indexer == 1
replace type = 3 if StatIncreaserSmall == 1
replace type = 4 if StatIncreaserLarge == 1

* Generate Relevant Employment Categories
egen stateempA = wtmean(employed) if group == 1, by(type year) weight(cmpwgt)
egen stateempB = max(stateempA), by(type year)
egen stateempC = wtmean(employed) if age <= 21, by(type year) weight(cmpwgt)
egen stateempD = max(stateempC), by(type year)
egen stateempE = wtmean(employed) if dropout ==1 & age <= 25, by(type year) weight(cmpwgt)
egen stateempF = max(stateempE), by(type year)
egen stateempG = wtmean(employed) if age > 25 & age <= 54, by(type year) weight(cmpwgt)
egen stateempH = max(stateempG), by(type year)
egen stateempI = wtmean(employed) if age <= 17, by(type year) weight(cmpwgt)
egen stateempJ = max(stateempI), by(type year)
*
 
gen JanMinimumWage =.

forvalues i=2011/2019 {
replace JanMinimumWage = jan`i'min if year == `i'
}
*

collapse stateempB stateempD stateempF stateempH stateempJ JanMinimumWage HPI PersonalIncome, by(type year)

* Generate changes since 2013 for each series
foreach var in stateempB stateempD stateempF stateempH stateempJ JanMinimumWage HPI PersonalIncome {
bysort type: gen `var'13 = `var' if year == 2013
bysort type: egen `var'2013 = max(`var'13)
bysort type: gen pctdiff_`var' = (`var')/`var'2013
drop `var'2013 `var'13
}

reshape wide *stateempB *stateempD *stateempF *stateempH *stateempJ *JanMinimumWage *HPI *PersonalIncome, i(year) j(type)

foreach var in stateempB stateempD stateempF stateempH stateempJ JanMinimumWage HPI PersonalIncome {
label var `var'1 "No Change"
label var `var'2 "Indexer"
label var `var'3 "Statutory Increaser Under $1"
label var `var'4 "Statutory Increaser $1 or More"

label var pctdiff_`var'1 "No Change"
label var pctdiff_`var'2 "Indexer"
label var pctdiff_`var'3 "Statutory Increaser Under $1"
label var pctdiff_`var'4 "Statutory Increaser $1 or More"
}

grstyle init
grstyle color background white
grstyle graphsize x 8
grstyle graphsize y 7
grstyle set legend, nobox

graph drop _all
 

* HPI 
graph twoway scatter HPI1 year, msize(medlarge) lwidth(thin) lcolor(blue) mcolor(blue) connect(direct) ||  ///
    scatter HPI2 year, msize(large) lwidth(thick) lcolor(bluishgray) mcolor(bluishgray) connect(direct) ||  ///
    scatter HPI3 year, msymbol(Dh) msize(medlarge) lwidth(thick) lcolor(navy) mcolor(navy) connect(direct) || ///
			scatter HPI4 year, msymbol(Dh) msize(medium) lwidth(medium) lcolor(midblue) mcolor(midblue) connect(direct) ///
name(HPI, replace) title("Panel A: Average House Price Index", size(medsmall)) ///
ylabel(250(150)650, gmin gmax) ///
xlabel(2011(2)2019) ysize(4) xsize(5.5) ///
ytitle("Average House Price Index") ///
xtitle("") bgcolor(white) graphregion(color(white))
graph export "$figdir/time-series-cep-hpi.pdf", as(pdf) replace


* PERSONAL INCOME
graph twoway scatter PersonalIncome1 year, msize(medlarge) lwidth(thin) lcolor(blue) mcolor(blue) connect(direct) ||  ///
    scatter PersonalIncome2 year, msize(large) lwidth(thick) lcolor(bluishgray) mcolor(bluishgray) connect(direct) ||  ///
    scatter PersonalIncome3 year, msymbol(Dh) msize(medlarge) lwidth(thick) lcolor(navy) mcolor(navy) connect(direct) || ///
			scatter PersonalIncome4 year, msymbol(Dh) msize(medium) lwidth(medium) lcolor(midblue) mcolor(midblue) connect(direct) ///
name(income, replace) title("Panel B: Personal Income", size(medsmall)) ///
ylabel(35(5)70, gmin gmax) ///
xlabel(2011(2)2019) ysize(4) xsize(5.5) ///
ytitle("Average Per Capita Income (Thousands)") ///
xtitle("") bgcolor(white) graphregion(color(white))
graph export "$figdir/time-series-cep-income.pdf", as(pdf) replace